//
// Created by Yanzhenbo on 2023/3/1.
//
#ifndef __LOCATER__H
#define __LOCATER__H

#include "main.h"
#include "stm32f4xx.h"


#define shoot_point_left point_1
#define shoot_point_right point_2
#define shoot_point_mid point_3

#define shoot_base_y 80.0f
#define shoot_base_yaw 0.9f

#define shoot_base_mid 3.0f
typedef struct
{
    float  pos_x;
    float  pos_y;
    float  angle;
    float angle_last;
    float total_angle;
    int16_t round;
}locater_def;


typedef union
{
    uint8_t data_u8[4];
    int8_t data_i8[4];
    int32_t data_i32;
    float data_f;
}union32;

typedef union
{
    uint8_t data_u8[8];
    int8_t data_i8[8];
    int32_t data_i32[2];
    float data_f[2];
}union64;
extern float delta_x, delta_y;
extern locater_def locater;
extern locater_def aim_point;
extern uint8_t robot_point_now;

void locater_data_rec(uint8_t *data, locater_def *loc);
void run_to(locater_def *aim);
void open_auto_run(locater_def *aim);
void set_auto_point(uint8_t wpoint);
float get_dis2(float x0, float y0, float x1, float y1);
void go_to_ring_left();
#endif //__LOCATER__H
